package com.lagou.demo.controller;

import com.lagou.demo.service.IDemoService;
import com.lagou.edu.mvcframework.annotations.LagouAutowired;
import com.lagou.edu.mvcframework.annotations.LagouController;
import com.lagou.edu.mvcframework.annotations.LagouRequestMapping;
import com.lagou.edu.mvcframework.annotations.LagouSecurity;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@LagouController
@LagouRequestMapping("/lol")
public class DemoController {


    @LagouAutowired
    private IDemoService demoService;


    /**
     * URL: /lol/delailianmeng?name=delaiwen
     *
     * @param request
     * @param response
     * @param name
     * @return
     */
    @LagouRequestMapping("/delailianmeng")
    @LagouSecurity({"delaiwen","luoke"})
    public void delailianmeng(HttpServletRequest request, HttpServletResponse response, String name) throws IOException {
        System.out.println("获取到参数 --> name : "+name);
        response.setHeader("Content-type", "text/html;charset=UTF-8");
        response.setCharacterEncoding("UTF-8");
        response.getWriter().write(" 欢迎 "+name +" 来到德莱联盟");

    }

    @LagouRequestMapping("/zuan")
    @LagouSecurity({"mengduo"})
    public void zuan(HttpServletRequest request, HttpServletResponse response, String name) throws IOException {
        System.out.println("获取到参数 --> name : "+name);
        response.setHeader("Content-type", "text/html;charset=UTF-8");
        response.setCharacterEncoding("UTF-8");
        response.getWriter().write(" 欢迎 "+name +" 来到祖安");

    }

    @LagouRequestMapping("/demaxiya")
    @LagouSecurity({"gailun"})
    public void demaxiya(HttpServletRequest request, HttpServletResponse response, String name) throws IOException {
        System.out.println("获取到参数 --> name : "+name);
        response.setHeader("Content-type", "text/html;charset=UTF-8");
        response.setCharacterEncoding("UTF-8");
        response.getWriter().write(" 欢迎 "+name +" 来到德玛西亚");

    }

}
